package com.lxh.composite;

/**
 * 组合模式
 * Create by lxh on 2020/2/12
 */
public class Main {
    public static void main(String[] args) {
        ConcreteCompany root = new ConcreteCompany("北京总公司");
        root.add(new HRDepartment("总公司人力资源部"));
        root.add(new HRDepartment("总公司人力资源分部"));

        ConcreteCompany company = new ConcreteCompany("上海分公司");
        company.add(new HRDepartment("总公司人力资源部"));
        company.add(new HRDepartment("总公司人力资源分部"));
        root.add(company);

        ConcreteCompany company1 = new ConcreteCompany("南京分公司");
        company1.add(new HRDepartment("总公司人力资源部"));
        company1.add(new HRDepartment("总公司人力资源分部"));
        root.add(company1);

        root.display(1);
    }
}
